<?php

namespace app\admin\controller;

use think\Controller;
use app\admin\model\Files as F;

class Files extends Controller
{

    /**
     * 图片上传
     *
     */
    public function upload_post()
    {
        $f       = new F();
        $rand_id = $f->upload('Filedata', '', 1, '', input('id',0));
        $v       = $f->detail($rand_id);
//        $type    = get_extname($f->file_url);
        echo json_encode(
            [
                "file"    => $v->file_url,
                "name"    => $v->file_name,
                "fileext" => $v->file_ext,
                "time"    => $v->file_time,
                'rand'    => $v->rand_id,
                'id'      => $v->id,
                "result"  => 1
            ]
        );
    }

}
